Thorium Server

Streaming

Input Stream can be used to facilitate the streaming of files or data.

For example, to stream down a file named "bigfile.txt" in src/main/resources folder, simply return an InputStream like below

import java.io.InputStream

@Get("/stream")
def streamImage = Action: request =>
  getClass.getClassLoader.getResourceAsStream("bigfile.txt")
Last modified on 22/11/2023, 3:50 pm